package day07.concurrent04;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * Atomic
 */
public class Demo06 {
    static AtomicInteger x = new AtomicInteger(0);
    public static void main(String[] args) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                for(int i = 0;i<100;i++){
                    System.out.println(x.incrementAndGet());
                }
            }
        }).start();
        new Thread(new Runnable() {
            @Override
            public void run() {
                for(int i = 0;i<100;i++){
                    System.out.println(x.incrementAndGet());
                }
            }
        }).start();

    }
}
